import {requestInfo} from '@/api/public.js'

/**
 * 商品评价
 */
export class EvaluationService {
    // 分页查询列表
    static findEvaluations (queryParams) {
        return requestInfo({
            url: '/mall/good/Evaluation/findEvaluations',
            method: 'POST',
            data: queryParams
        });
    }

    //根据ID查询指定的商品评价
    static findEvaluation (evaluationId) {
        const query = {
            evaluationId
        }
        return requestInfo({
            url: '/mall/good/Evaluation/findEvaluation',
            method: 'POST',
            params: query,
        });
    }

    //根据ID查询指定的商品评价(包含外键名称)
    static findEvaluationForView (evaluationId) {
        const query = {
            evaluationId
        }
        return requestInfo({
            url: '/mall/good/Evaluation/findEvaluationForView',
            method: 'POST',
            params: query,
        });
    }

    //根据ID查询指定的商品评价(包含外键名称)
    static findEvaluationForEdit (evaluationId) {
        const query = {
            evaluationId
        }
        return requestInfo({
            url: '/mall/good/Evaluation/findEvaluationForEdit',
            method: 'POST',
            params: query,
        });
    }

    //根据ID查询指定的商品评价(只提取ID 和 Name)
    static findEvaluationsWithIdNameById (evaluationId) {
        const query = {
            evaluationId
        }
        return requestInfo({
            url: '/mall/good/Evaluation/findEvaluationsWithIdNameById',
            method: 'POST',
            params: query,
        });
    }

    //根据名称查询商品评价集合(只提取ID 和 Name)
    static findEvaluationsWithIdNameByName (evaluationName) {
        const query = {
            evaluationName
        }
        return requestInfo({
            url: '/mall/good/Evaluation/findEvaluationsWithIdNameByName',
            method: 'POST',
            params: query,
        });
    }

    //新增保存商品评价
    static saveEvaluation (evaluation) {
        const query = {}
        return requestInfo({
            url: '/mall/good/Evaluation/saveEvaluation',
            method: 'POST',
            params: query,
            data: evaluation
        });
    }

    //修改保存商品评价
    static updateEvaluation (evaluation) {
        const query = {}
        return requestInfo({
            url: '/mall/good/Evaluation/updateEvaluation',
            method: 'POST',
            params: query,
            data: evaluation
        });
    }

    //根据ID查询指定的商品评价(只提取ID 和 Name)
    static deleteEvaluation (evaluationId) {
        const query = {
            evaluationId
        }
        return requestInfo({
            url: '/mall/good/Evaluation/deleteEvaluation',
            method: 'POST',
            params: query,
        });
    }
}
